Manage-DHCP

Assigning a New IP Address via DHCP

#resources/networking/dhcp
In Linux, the Dynamic Host Configuration Protocol (DHCP) is responsible for assigning IP addresses automatically on a network. This is typically handled by a background service or daemon called dhcpd.

Why it matters ?
The DHCP server logs which IP addresses are assigned to which devices valuable information in forensic investigations for tracking attackers.


we will Learn how to:

  • Manually request a new DHCP-assigned IP without rebooting
  • Understand how the dhcpcd process works
  • Verify your assigned IP using command-line tools

Step-by-Step: Get a New IP from DHCP

Use dhcpcd to Request a New IP

Most Debian-based distros (like Kali Linux) use the dhclient(old version kali) or dhcpcd(new version) utility to interact with DHCP.

  • dhcpcd --help
  • sudo dhcpcd eth0
  • dhcpcd: The DHCP client program
  • eth0: Your network interface (may vary: use ip a to list interfaces)

This sends a DHCPDISCOVER request. The DHCP server responds with a DHCPOFFER, and the client confirms it with a DHCPREQUEST.

+------------+                 +-----------------+
|  DHCP      |                 |     Client      |
|  Server    |                 | (e.g., Kali)    |
+------------+                 +-----------------+
       ^                               |
       |                               | (1) DHCPDISCOVER
       | <---------------------------- |
       |                               |
       |                               | (2) DHCPOFFER
       | ----------------------------> |
       |                               |
       |                               | (3) DHCPREQUEST
       | <---------------------------- |
       |                               |
       |                               | (4) DHCPACK
       | ----------------------------> |
       |                               |
1.DHCPDISCOVER: Client broadcasts a message to find available DHCP servers.

2.DHCPOFFER: Server responds with an available IP address and configuration options.

3.DHCPREQUEST: Client requests the offered IP address.

4.DHCPACK: Server acknowledges and finalizes the IP assignment.